﻿using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApp3
{
    /// <summary>
    /// FileSave.xaml 的交互逻辑
    /// </summary>
    public partial class FileSave : Window
    {
        public FileSave()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            //设置选择文件的类型
            openFileDialog.Filter = "Sql 文件(*.sql)|*.sql|所有文件(*.*)|*.*";
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog()==true) {
                string file = openFileDialog.FileName;
                //this.text=file;
            }
        }
        //保存文件
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            //设置选择文件的类型
            saveFileDialog.Filter = "Sql 文件(*.sql)|*.sql|所有文件(*.*)|*.*";
            saveFileDialog.FilterIndex = 1;
            saveFileDialog.ShowDialog();
            if (saveFileDialog.ShowDialog() == true) {
                //获取保存路径
                string fn = saveFileDialog.FileName;
                //文件内容写入
            }
        }
    }
}
